www.gusucode.com > 基于Matlab的MIMO通信系统仿真源码程序 > code9/mimo/matlab for mimo 2x2/hex2int.m

    

function x_int=hex2int(x_hex);

x_int=0;
e=0;
for i1=length(x_hex):-1:1
   str=x_hex(i1);
   switch upper(str)
       case '0', temp=0;
       case '1', temp=1;
       case '2', temp=2;
       case '3', temp=3;
       case '4', temp=4;
       case '5', temp=5;
       case '6', temp=6;
       case '7', temp=7;
       case '8', temp=8;
       case '9', temp=9;
       case 'A', temp=10;
       case 'B', temp=11;
       case 'C', temp=12;
       case 'D', temp=13;
       case 'E', temp=14;
       case 'F', temp=15;
   end;
        
   x_int=x_int+temp*16^e;
   e=e+1;
end;